/**
 * 描述: 任务路由模块
 * 作者: 
 * 日期: 
 */

const express = require('express');
const service = require('../services/taskService');
const userService = require('../services/userService');
const router = express.Router();

// //测试案例
router.get('/demo', userService.setToken, function(req, res) {
    // console.log(req.headers.authorization);
    let data = {
        DriverName: 'wang',
        PhoneNum: '15955853832',
        TruckLic: '皖BKFT903',
        FleetCName: '一二三四五六七八九十一二三四五'
    }
    res.render('receipt', { data: data })
})

router.get('/demo1', userService.setToken, function(req, res) {
    let data = {
        DriverName: 'wang',
        PhoneNum: '15955853832',
        TruckLic: '皖BKFT903',
        Direction: '0',
        FleetCName: '一二三四五六七八九十一二三四五'
    }
    res.render('ctimes', { data: data, Direction: '1', Channel: '22', limit_flag_in: false, limit_flag_out: false })
})

router.get('/demo2', function(req, res) {
    //'DriverID', 'DriverName', 'PhoneNum', 'status', 'FleetID'
    res.render('login', { redirect: '#' })
})


//当前任务小票
router.post('/currentReceipt', service.getCurrentReceipt);


//历史任务小票
router.post('/historyReceipt', service.getHistoryReceipt);


//获取大桥证优惠列表
router.post('/getCouponList', service.getCouponList);


//server数据库端发送小票信息，处理用户新的小票信息
router.post('/sendMessage', service.sendMessage);


//服务状态消息
router.post('/sendMsgToAll', service.sendMsgToAll);


//使用大桥优惠证
router.put('/useCoupon', service.useCoupon);


//堆场信息
router.get('/gardenInfo', service.gardenInfo);

//修改小票的状态
router.get('/toComplishBtn', service.toComplishBtn)

module.exports = router;